/* 基础样式重置与全局设置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    min-height: 100vh;
}

/* 颜色方案 - 使用CSS变量便于主题切换 */
:root {
    /* 主色调 */
    --primary: #3498db;
    --primary-dark: #2980b9;
    --primary-light: #ebf5fb;

    /* 辅助色 */
    --success: #2ecc71;
    --danger: #e74c3c;
    --warning: #f39c12;
    --purple: #9b59b6;
    --gold: #d4af37;
    --gray: #7f8c8d;

    /* 分类标签颜色 */
    --category-gold: #d4af37;
    --category-stock: #2ecc71;
    --category-exchange: #3498db;
    --category-commodity: #e67e22;
    --category-bond: #9b59b6;
    --category-monetary: #e74c3c;

    /* 文本颜色 */
    --text-primary: #333;
    --text-secondary: #555;
    --text-tertiary: #666;
    --text-light: #777;
    --text-lighter: #999;
    --text-white: #fff;

    /* 背景颜色 */
    --bg-primary: #f9f9f9;
    --bg-secondary: #fff;
    --bg-tertiary: #f8fcff;
    --bg-highlight: #f1f5f9;

    /* 边框和分割线颜色 */
    --border-light: #f0f0f0;
    --border-medium: #e1e4e8;
    --border-dark: #ddd;
    --border-dashed: #f0f0f0;

    /* 阴影 */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 2px 5px rgba(0,0,0,0.07);
    --shadow-lg: 0 5px 15px rgba(0,0,0,0.08);
    --shadow-hover: 0 2px 5px rgba(0,0,0,0.1);
}

/* 排版系统 */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

h1 {
    font-size: 1.8rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.3rem;
}

p {
    margin-bottom: 1rem;
}

small {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* 通用组件样式 */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 15px;
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    background: none;
    text-decoration: none;
    min-height: 44px;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--text-white);
    border: 1px solid var(--primary);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background-color: transparent;
    color: var(--primary);
    border: 1px solid var(--border-medium);
}

.btn-outline:hover {
    background-color: var(--bg-highlight);
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* 卡片样式 */
.card {
    background: var(--bg-secondary);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    border: 1px solid transparent;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--border-medium);
}

/* 标签样式 */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.8rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    text-shadow: 0 1px 1px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.badge:hover {
    transform: scale(1.05);
}

.badge-primary {
    background-color: var(--primary);
    color: var(--text-white);
}

.badge-success {
    background-color: var(--success);
    color: var(--text-white);
}

.badge-danger {
    background-color: var(--danger);
    color: var(--text-white);
}

.badge-warning {
    background-color: var(--warning);
    color: var(--text-white);
}

/* 分类标签样式 */
.category-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
    color: var(--text-white);
    font-size: 0.8rem;
    margin-bottom: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    text-shadow: 0 1px 1px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.category-tag:hover {
    transform: scale(1.05);
}

.category-tag.黄金 { background-color: var(--category-gold); }
.category-tag.股票 { background-color: var(--category-stock); }
.category-tag.汇率 { background-color: var(--category-exchange); }
.category-tag.大宗商品 { background-color: var(--category-commodity); }
.category-tag.债券 { background-color: var(--category-bond); }
.category-tag.货币政策 { background-color: var(--category-monetary); }

/* 计数徽章 */
.count-badge {
    font-size: 0.7rem;
    padding: 1px 5px;
    border-radius: 10px;
    background-color: var(--primary);
    color: var(--text-white);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* 动画和过渡效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.1); }
    70% { box-shadow: 0 0 0 8px rgba(52, 152, 219, 0); }
    100% { box-shadow: 0 0 0 0 rgba(52, 152, 219, 0); }
}

.fade-in {
    animation: fadeIn 0.8s ease-out;
}

.pulse {
    animation: pulse 2s infinite;
}

/* 响应式工具类 */
.mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

/* 辅助类 */
.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

/* 响应式断点 */
@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }

    .desktop-only {
        display: none;
    }

    .container {
        padding: 10px;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.3rem;
    }

    /* 增大触摸目标，便于移动端点击 */
    .btn, .clickable {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 15px;
    }

    h1 {
        font-size: 1.3rem;
    }

    h2 {
        font-size: 1.1rem;
    }
    input, textarea, select {
        font-size: 16px !important;
        line-height: 1.5;
        padding: 8px 12px;
        box-sizing: border-box;
    }
    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="number"] {
        font-size: 16px !important;
    }
}
